//
// C++ Implementation: leveldata
//
// Description: 
//
//
// Author: James Grimwood <james@piku.org.uk>, (C) 2007
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "leveldata.h"
#include <iostream>

levelData::levelData()
{
}


levelData::~levelData()
{
}


/**
 * Defines an enemy type
 * @param type A numeric type identifier. This is used as a key so must be unique
 * @param score How much this enemy is worth when destroyed
 * @param maxHealth The maximum health of this enemy
 * @param shotPower How much damage this enemy does to the player when it shoots
 * @return True if the enemy was successfully created, or false otherwise
 */
bool levelData::DefineEnemy( int type, int score, float maxHealth, float shotPower, string name )
{
    pair<map<int,enemyData*>::iterator,bool> ret;
    
    enemyData *newEnemy = new enemyData;
    newEnemy->typeID = type;
    newEnemy->score = score;
    newEnemy->maxHealth = maxHealth;
    newEnemy->shotPower = shotPower;
    newEnemy->name = name;
    
    ret = enemyMap.insert (pair<int,enemyData*>(type, newEnemy) );
    if (ret.second==false)
    {
        cout << "element " << type << " already existed";
        cout << " with a value of " << ret.first->second->name << endl;
        return false;
    }

    return true;
}


